﻿using System; 
using System.Text;
using System.Data.SqlClient;
using System.Collections.Generic; 
using System.Data;

namespace Sasc.PV.DAL
{
		/// <summary>
	/// ERPUser
	/// </summary>
		public partial class ERPUser:IPVDomain
	{ 
		#region Fields
	    	private int _id;		
		/// <summary>
		/// ID
        /// </summary>		
        public int ID
        {
            get{ return _id; }
            set{ _id = value; }
        }        
			private string _username;		
		/// <summary>
		/// UserName
        /// </summary>		
        public string UserName
        {
            get{ return _username; }
            set{ _username = value; }
        }        
			private string _userpwd;		
		/// <summary>
		/// UserPwd
        /// </summary>		
        public string UserPwd
        {
            get{ return _userpwd; }
            set{ _userpwd = value; }
        }        
			private string _truename;		
		/// <summary>
		/// TrueName
        /// </summary>		
        public string TrueName
        {
            get{ return _truename; }
            set{ _truename = value; }
        }        
			private string _serils;		
		/// <summary>
		/// Serils
        /// </summary>		
        public string Serils
        {
            get{ return _serils; }
            set{ _serils = value; }
        }        
			private string _department;		
		/// <summary>
		/// Department
        /// </summary>		
        public string Department
        {
            get{ return _department; }
            set{ _department = value; }
        }        
			private string _jiaose;		
		/// <summary>
		/// JiaoSe
        /// </summary>		
        public string JiaoSe
        {
            get{ return _jiaose; }
            set{ _jiaose = value; }
        }        
			private DateTime _activetime;		
		/// <summary>
		/// ActiveTime
        /// </summary>		
        public DateTime ActiveTime
        {
            get{ return _activetime; }
            set{ _activetime = value; }
        }        
			private string _zhiwei;		
		/// <summary>
		/// ZhiWei
        /// </summary>		
        public string ZhiWei
        {
            get{ return _zhiwei; }
            set{ _zhiwei = value; }
        }        
			private string _zaigang;		
		/// <summary>
		/// ZaiGang
        /// </summary>		
        public string ZaiGang
        {
            get{ return _zaigang; }
            set{ _zaigang = value; }
        }        
			private string _emailstr;		
		/// <summary>
		/// EmailStr
        /// </summary>		
        public string EmailStr
        {
            get{ return _emailstr; }
            set{ _emailstr = value; }
        }        
			private string _iflogin;		
		/// <summary>
		/// IfLogin
        /// </summary>		
        public string IfLogin
        {
            get{ return _iflogin; }
            set{ _iflogin = value; }
        }        
			private string _sex;		
		/// <summary>
		/// Sex
        /// </summary>		
        public string Sex
        {
            get{ return _sex; }
            set{ _sex = value; }
        }        
			private string _backinfo;		
		/// <summary>
		/// BackInfo
        /// </summary>		
        public string BackInfo
        {
            get{ return _backinfo; }
            set{ _backinfo = value; }
        }        
			private string _birthday;		
		/// <summary>
		/// BirthDay
        /// </summary>		
        public string BirthDay
        {
            get{ return _birthday; }
            set{ _birthday = value; }
        }        
			private string _mingzu;		
		/// <summary>
		/// MingZu
        /// </summary>		
        public string MingZu
        {
            get{ return _mingzu; }
            set{ _mingzu = value; }
        }        
			private string _sfzserils;		
		/// <summary>
		/// SFZSerils
        /// </summary>		
        public string SFZSerils
        {
            get{ return _sfzserils; }
            set{ _sfzserils = value; }
        }        
			private string _hunying;		
		/// <summary>
		/// HunYing
        /// </summary>		
        public string HunYing
        {
            get{ return _hunying; }
            set{ _hunying = value; }
        }        
			private string _zhengzhimianmao;		
		/// <summary>
		/// ZhengZhiMianMao
        /// </summary>		
        public string ZhengZhiMianMao
        {
            get{ return _zhengzhimianmao; }
            set{ _zhengzhimianmao = value; }
        }        
			private string _jiguan;		
		/// <summary>
		/// JiGuan
        /// </summary>		
        public string JiGuan
        {
            get{ return _jiguan; }
            set{ _jiguan = value; }
        }        
			private string _hukou;		
		/// <summary>
		/// HuKou
        /// </summary>		
        public string HuKou
        {
            get{ return _hukou; }
            set{ _hukou = value; }
        }        
			private string _xueli;		
		/// <summary>
		/// XueLi
        /// </summary>		
        public string XueLi
        {
            get{ return _xueli; }
            set{ _xueli = value; }
        }        
			private string _zhicheng;		
		/// <summary>
		/// ZhiCheng
        /// </summary>		
        public string ZhiCheng
        {
            get{ return _zhicheng; }
            set{ _zhicheng = value; }
        }        
			private string _biyeyuanxiao;		
		/// <summary>
		/// BiYeYuanXiao
        /// </summary>		
        public string BiYeYuanXiao
        {
            get{ return _biyeyuanxiao; }
            set{ _biyeyuanxiao = value; }
        }        
			private string _zhuanye;		
		/// <summary>
		/// ZhuanYe
        /// </summary>		
        public string ZhuanYe
        {
            get{ return _zhuanye; }
            set{ _zhuanye = value; }
        }        
			private string _canjiagongzuotime;		
		/// <summary>
		/// CanJiaGongZuoTime
        /// </summary>		
        public string CanJiaGongZuoTime
        {
            get{ return _canjiagongzuotime; }
            set{ _canjiagongzuotime = value; }
        }        
			private string _jiarubendanweitime;		
		/// <summary>
		/// JiaRuBenDanWeiTime
        /// </summary>		
        public string JiaRuBenDanWeiTime
        {
            get{ return _jiarubendanweitime; }
            set{ _jiarubendanweitime = value; }
        }        
			private string _jiatingdianhua;		
		/// <summary>
		/// JiaTingDianHua
        /// </summary>		
        public string JiaTingDianHua
        {
            get{ return _jiatingdianhua; }
            set{ _jiatingdianhua = value; }
        }        
			private string _jiatingaddress;		
		/// <summary>
		/// JiaTingAddress
        /// </summary>		
        public string JiaTingAddress
        {
            get{ return _jiatingaddress; }
            set{ _jiatingaddress = value; }
        }        
			private string _gangweibiandong;		
		/// <summary>
		/// GangWeiBianDong
        /// </summary>		
        public string GangWeiBianDong
        {
            get{ return _gangweibiandong; }
            set{ _gangweibiandong = value; }
        }        
			private string _jiaoyuebeijing;		
		/// <summary>
		/// JiaoYueBeiJing
        /// </summary>		
        public string JiaoYueBeiJing
        {
            get{ return _jiaoyuebeijing; }
            set{ _jiaoyuebeijing = value; }
        }        
			private string _gongzuojianli;		
		/// <summary>
		/// GongZuoJianLi
        /// </summary>		
        public string GongZuoJianLi
        {
            get{ return _gongzuojianli; }
            set{ _gongzuojianli = value; }
        }        
			private string _shehuiguanxi;		
		/// <summary>
		/// SheHuiGuanXi
        /// </summary>		
        public string SheHuiGuanXi
        {
            get{ return _shehuiguanxi; }
            set{ _shehuiguanxi = value; }
        }        
			private string _jiangchengjilu;		
		/// <summary>
		/// JiangChengJiLu
        /// </summary>		
        public string JiangChengJiLu
        {
            get{ return _jiangchengjilu; }
            set{ _jiangchengjilu = value; }
        }        
			private string _zhiwuqingkuang;		
		/// <summary>
		/// ZhiWuQingKuang
        /// </summary>		
        public string ZhiWuQingKuang
        {
            get{ return _zhiwuqingkuang; }
            set{ _zhiwuqingkuang = value; }
        }        
			private string _peixunjilu;		
		/// <summary>
		/// PeiXunJiLu
        /// </summary>		
        public string PeiXunJiLu
        {
            get{ return _peixunjilu; }
            set{ _peixunjilu = value; }
        }        
			private string _danbaojilu;		
		/// <summary>
		/// DanBaoJiLu
        /// </summary>		
        public string DanBaoJiLu
        {
            get{ return _danbaojilu; }
            set{ _danbaojilu = value; }
        }        
			private string _naodonghetong;		
		/// <summary>
		/// NaoDongHeTong
        /// </summary>		
        public string NaoDongHeTong
        {
            get{ return _naodonghetong; }
            set{ _naodonghetong = value; }
        }        
			private string _shebaojiaona;		
		/// <summary>
		/// SheBaoJiaoNa
        /// </summary>		
        public string SheBaoJiaoNa
        {
            get{ return _shebaojiaona; }
            set{ _shebaojiaona = value; }
        }        
			private string _tijianjilu;		
		/// <summary>
		/// TiJianJiLu
        /// </summary>		
        public string TiJianJiLu
        {
            get{ return _tijianjilu; }
            set{ _tijianjilu = value; }
        }        
			private string _beizhustr;		
		/// <summary>
		/// BeiZhuStr
        /// </summary>		
        public string BeiZhuStr
        {
            get{ return _beizhustr; }
            set{ _beizhustr = value; }
        }        
			private string _fujian;		
		/// <summary>
		/// FuJian
        /// </summary>		
        public string FuJian
        {
            get{ return _fujian; }
            set{ _fujian = value; }
        }        
			private string _pop3username;		
		/// <summary>
		/// POP3UserName
        /// </summary>		
        public string POP3UserName
        {
            get{ return _pop3username; }
            set{ _pop3username = value; }
        }        
			private string _pop3userpwd;		
		/// <summary>
		/// POP3UserPwd
        /// </summary>		
        public string POP3UserPwd
        {
            get{ return _pop3userpwd; }
            set{ _pop3userpwd = value; }
        }        
			private string _pop3server;		
		/// <summary>
		/// POP3Server
        /// </summary>		
        public string POP3Server
        {
            get{ return _pop3server; }
            set{ _pop3server = value; }
        }        
			private string _pop3port;		
		/// <summary>
		/// POP3Port
        /// </summary>		
        public string POP3Port
        {
            get{ return _pop3port; }
            set{ _pop3port = value; }
        }        
			private string _smtpusername;		
		/// <summary>
		/// SMTPUserName
        /// </summary>		
        public string SMTPUserName
        {
            get{ return _smtpusername; }
            set{ _smtpusername = value; }
        }        
			private string _smtpuserpwd;		
		/// <summary>
		/// SMTPUserPwd
        /// </summary>		
        public string SMTPUserPwd
        {
            get{ return _smtpuserpwd; }
            set{ _smtpuserpwd = value; }
        }        
			private string _smtpserver;		
		/// <summary>
		/// SMTPServer
        /// </summary>		
        public string SMTPServer
        {
            get{ return _smtpserver; }
            set{ _smtpserver = value; }
        }        
			private string _smtpfromemail;		
		/// <summary>
		/// SMTPFromEmail
        /// </summary>		
        public string SMTPFromEmail
        {
            get{ return _smtpfromemail; }
            set{ _smtpfromemail = value; }
        }        
			private string _tixingtime;		
		/// <summary>
		/// TiXingTime
        /// </summary>		
        public string TiXingTime
        {
            get{ return _tixingtime; }
            set{ _tixingtime = value; }
        }        
			private string _iftixing;		
		/// <summary>
		/// IfTiXing
        /// </summary>		
        public string IfTiXing
        {
            get{ return _iftixing; }
            set{ _iftixing = value; }
        }        
			private string _daohanglist;		
		/// <summary>
		/// DaoHangList
        /// </summary>		
        public string DaoHangList
        {
            get{ return _daohanglist; }
            set{ _daohanglist = value; }
        }        
			private string _xkeguandep;		
		/// <summary>
		/// xKeGuanDep
        /// </summary>		
        public string xKeGuanDep
        {
            get{ return _xkeguandep; }
            set{ _xkeguandep = value; }
        }        
			private string _xiashuuser;		
		/// <summary>
		/// XiaShuUser
        /// </summary>		
        public string XiaShuUser
        {
            get{ return _xiashuuser; }
            set{ _xiashuuser = value; }
        }        
			private string _daohangidlist;		
		/// <summary>
		/// DaoHangIDList
        /// </summary>		
        public string DaoHangIDList
        {
            get{ return _daohangidlist; }
            set{ _daohangidlist = value; }
        }        
		   		#endregion
   		
   		#region DAL Methods
		public bool Exists(int ID)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select count(1) from ERPUser");
			strSql.Append(" where ");
			                                       strSql.Append(" ID = @ID  ");
                            			SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4)
			};
			parameters[0].Value = ID;

			return DbHelperSQL.Exists(strSql.ToString(),parameters);
		}
		
		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add()
		{
          return  Add(this);
		}
				
		
		/// <summary>
		/// 增加一条数据
		/// </summary>
		public int Add(ERPUser model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into ERPUser(");			
            strSql.Append("UserName,UserPwd,TrueName,Serils,Department,JiaoSe,ActiveTime,ZhiWei,ZaiGang,EmailStr,IfLogin,Sex,BackInfo,BirthDay,MingZu,SFZSerils,HunYing,ZhengZhiMianMao,JiGuan,HuKou,XueLi,ZhiCheng,BiYeYuanXiao,ZhuanYe,CanJiaGongZuoTime,JiaRuBenDanWeiTime,JiaTingDianHua,JiaTingAddress,GangWeiBianDong,JiaoYueBeiJing,GongZuoJianLi,SheHuiGuanXi,JiangChengJiLu,ZhiWuQingKuang,PeiXunJiLu,DanBaoJiLu,NaoDongHeTong,SheBaoJiaoNa,TiJianJiLu,BeiZhuStr,FuJian,POP3UserName,POP3UserPwd,POP3Server,POP3Port,SMTPUserName,SMTPUserPwd,SMTPServer,SMTPFromEmail,TiXingTime,IfTiXing,DaoHangList,xKeGuanDep,XiaShuUser,DaoHangIDList");
			strSql.Append(") values (");
            strSql.Append("@UserName,@UserPwd,@TrueName,@Serils,@Department,@JiaoSe,@ActiveTime,@ZhiWei,@ZaiGang,@EmailStr,@IfLogin,@Sex,@BackInfo,@BirthDay,@MingZu,@SFZSerils,@HunYing,@ZhengZhiMianMao,@JiGuan,@HuKou,@XueLi,@ZhiCheng,@BiYeYuanXiao,@ZhuanYe,@CanJiaGongZuoTime,@JiaRuBenDanWeiTime,@JiaTingDianHua,@JiaTingAddress,@GangWeiBianDong,@JiaoYueBeiJing,@GongZuoJianLi,@SheHuiGuanXi,@JiangChengJiLu,@ZhiWuQingKuang,@PeiXunJiLu,@DanBaoJiLu,@NaoDongHeTong,@SheBaoJiaoNa,@TiJianJiLu,@BeiZhuStr,@FuJian,@POP3UserName,@POP3UserPwd,@POP3Server,@POP3Port,@SMTPUserName,@SMTPUserPwd,@SMTPServer,@SMTPFromEmail,@TiXingTime,@IfTiXing,@DaoHangList,@xKeGuanDep,@XiaShuUser,@DaoHangIDList");            
            strSql.Append(") ");            
            strSql.Append(";select @@IDENTITY");		
			SqlParameter[] parameters = {
			            new SqlParameter("@UserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@UserPwd", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@TrueName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Serils", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Department", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaoSe", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ActiveTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@ZhiWei", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZaiGang", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@EmailStr", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@IfLogin", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Sex", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@BackInfo", SqlDbType.NText) ,            
                        new SqlParameter("@BirthDay", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@MingZu", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SFZSerils", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@HunYing", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhengZhiMianMao", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiGuan", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@HuKou", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@XueLi", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhiCheng", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@BiYeYuanXiao", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhuanYe", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@CanJiaGongZuoTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaRuBenDanWeiTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaTingDianHua", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaTingAddress", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@GangWeiBianDong", SqlDbType.NText) ,            
                        new SqlParameter("@JiaoYueBeiJing", SqlDbType.NText) ,            
                        new SqlParameter("@GongZuoJianLi", SqlDbType.NText) ,            
                        new SqlParameter("@SheHuiGuanXi", SqlDbType.NText) ,            
                        new SqlParameter("@JiangChengJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@ZhiWuQingKuang", SqlDbType.NText) ,            
                        new SqlParameter("@PeiXunJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@DanBaoJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@NaoDongHeTong", SqlDbType.NText) ,            
                        new SqlParameter("@SheBaoJiaoNa", SqlDbType.NText) ,            
                        new SqlParameter("@TiJianJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@BeiZhuStr", SqlDbType.NText) ,            
                        new SqlParameter("@FuJian", SqlDbType.NText) ,            
                        new SqlParameter("@POP3UserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3UserPwd", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3Server", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3Port", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPUserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPUserPwd", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPServer", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPFromEmail", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@TiXingTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@IfTiXing", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@DaoHangList", SqlDbType.NText) ,            
                        new SqlParameter("@xKeGuanDep", SqlDbType.NText) ,            
                        new SqlParameter("@XiaShuUser", SqlDbType.NText) ,            
                        new SqlParameter("@DaoHangIDList", SqlDbType.NVarChar,4000)             
              
            };
			            
            parameters[0].Value = model.UserName;                        
            parameters[1].Value = model.UserPwd;                        
            parameters[2].Value = model.TrueName;                        
            parameters[3].Value = model.Serils;                        
            parameters[4].Value = model.Department;                        
            parameters[5].Value = model.JiaoSe;                        
            parameters[6].Value = model.ActiveTime;                        
            parameters[7].Value = model.ZhiWei;                        
            parameters[8].Value = model.ZaiGang;                        
            parameters[9].Value = model.EmailStr;                        
            parameters[10].Value = model.IfLogin;                        
            parameters[11].Value = model.Sex;                        
            parameters[12].Value = model.BackInfo;                        
            parameters[13].Value = model.BirthDay;                        
            parameters[14].Value = model.MingZu;                        
            parameters[15].Value = model.SFZSerils;                        
            parameters[16].Value = model.HunYing;                        
            parameters[17].Value = model.ZhengZhiMianMao;                        
            parameters[18].Value = model.JiGuan;                        
            parameters[19].Value = model.HuKou;                        
            parameters[20].Value = model.XueLi;                        
            parameters[21].Value = model.ZhiCheng;                        
            parameters[22].Value = model.BiYeYuanXiao;                        
            parameters[23].Value = model.ZhuanYe;                        
            parameters[24].Value = model.CanJiaGongZuoTime;                        
            parameters[25].Value = model.JiaRuBenDanWeiTime;                        
            parameters[26].Value = model.JiaTingDianHua;                        
            parameters[27].Value = model.JiaTingAddress;                        
            parameters[28].Value = model.GangWeiBianDong;                        
            parameters[29].Value = model.JiaoYueBeiJing;                        
            parameters[30].Value = model.GongZuoJianLi;                        
            parameters[31].Value = model.SheHuiGuanXi;                        
            parameters[32].Value = model.JiangChengJiLu;                        
            parameters[33].Value = model.ZhiWuQingKuang;                        
            parameters[34].Value = model.PeiXunJiLu;                        
            parameters[35].Value = model.DanBaoJiLu;                        
            parameters[36].Value = model.NaoDongHeTong;                        
            parameters[37].Value = model.SheBaoJiaoNa;                        
            parameters[38].Value = model.TiJianJiLu;                        
            parameters[39].Value = model.BeiZhuStr;                        
            parameters[40].Value = model.FuJian;                        
            parameters[41].Value = model.POP3UserName;                        
            parameters[42].Value = model.POP3UserPwd;                        
            parameters[43].Value = model.POP3Server;                        
            parameters[44].Value = model.POP3Port;                        
            parameters[45].Value = model.SMTPUserName;                        
            parameters[46].Value = model.SMTPUserPwd;                        
            parameters[47].Value = model.SMTPServer;                        
            parameters[48].Value = model.SMTPFromEmail;                        
            parameters[49].Value = model.TiXingTime;                        
            parameters[50].Value = model.IfTiXing;                        
            parameters[51].Value = model.DaoHangList;                        
            parameters[52].Value = model.xKeGuanDep;                        
            parameters[53].Value = model.XiaShuUser;                        
            parameters[54].Value = model.DaoHangIDList;                        
			   
			object obj = DbHelperSQL.GetSingle(strSql.ToString(),parameters);			
			if (obj == null)
			{
				return 0;
			}
			else
			{
				                    
            	return Convert.ToInt32(obj);
                                                                  
			}			   
            			
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update()
		{
			return Update(this);
		}
		
		/// <summary>
		/// 更新一条数据
		/// </summary>
		public bool Update(ERPUser model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update ERPUser set ");
			                                                
            strSql.Append(" UserName = @UserName , ");                                    
            strSql.Append(" UserPwd = @UserPwd , ");                                    
            strSql.Append(" TrueName = @TrueName , ");                                    
            strSql.Append(" Serils = @Serils , ");                                    
            strSql.Append(" Department = @Department , ");                                    
            strSql.Append(" JiaoSe = @JiaoSe , ");                                    
            strSql.Append(" ActiveTime = @ActiveTime , ");                                    
            strSql.Append(" ZhiWei = @ZhiWei , ");                                    
            strSql.Append(" ZaiGang = @ZaiGang , ");                                    
            strSql.Append(" EmailStr = @EmailStr , ");                                    
            strSql.Append(" IfLogin = @IfLogin , ");                                    
            strSql.Append(" Sex = @Sex , ");                                    
            strSql.Append(" BackInfo = @BackInfo , ");                                    
            strSql.Append(" BirthDay = @BirthDay , ");                                    
            strSql.Append(" MingZu = @MingZu , ");                                    
            strSql.Append(" SFZSerils = @SFZSerils , ");                                    
            strSql.Append(" HunYing = @HunYing , ");                                    
            strSql.Append(" ZhengZhiMianMao = @ZhengZhiMianMao , ");                                    
            strSql.Append(" JiGuan = @JiGuan , ");                                    
            strSql.Append(" HuKou = @HuKou , ");                                    
            strSql.Append(" XueLi = @XueLi , ");                                    
            strSql.Append(" ZhiCheng = @ZhiCheng , ");                                    
            strSql.Append(" BiYeYuanXiao = @BiYeYuanXiao , ");                                    
            strSql.Append(" ZhuanYe = @ZhuanYe , ");                                    
            strSql.Append(" CanJiaGongZuoTime = @CanJiaGongZuoTime , ");                                    
            strSql.Append(" JiaRuBenDanWeiTime = @JiaRuBenDanWeiTime , ");                                    
            strSql.Append(" JiaTingDianHua = @JiaTingDianHua , ");                                    
            strSql.Append(" JiaTingAddress = @JiaTingAddress , ");                                    
            strSql.Append(" GangWeiBianDong = @GangWeiBianDong , ");                                    
            strSql.Append(" JiaoYueBeiJing = @JiaoYueBeiJing , ");                                    
            strSql.Append(" GongZuoJianLi = @GongZuoJianLi , ");                                    
            strSql.Append(" SheHuiGuanXi = @SheHuiGuanXi , ");                                    
            strSql.Append(" JiangChengJiLu = @JiangChengJiLu , ");                                    
            strSql.Append(" ZhiWuQingKuang = @ZhiWuQingKuang , ");                                    
            strSql.Append(" PeiXunJiLu = @PeiXunJiLu , ");                                    
            strSql.Append(" DanBaoJiLu = @DanBaoJiLu , ");                                    
            strSql.Append(" NaoDongHeTong = @NaoDongHeTong , ");                                    
            strSql.Append(" SheBaoJiaoNa = @SheBaoJiaoNa , ");                                    
            strSql.Append(" TiJianJiLu = @TiJianJiLu , ");                                    
            strSql.Append(" BeiZhuStr = @BeiZhuStr , ");                                    
            strSql.Append(" FuJian = @FuJian , ");                                    
            strSql.Append(" POP3UserName = @POP3UserName , ");                                    
            strSql.Append(" POP3UserPwd = @POP3UserPwd , ");                                    
            strSql.Append(" POP3Server = @POP3Server , ");                                    
            strSql.Append(" POP3Port = @POP3Port , ");                                    
            strSql.Append(" SMTPUserName = @SMTPUserName , ");                                    
            strSql.Append(" SMTPUserPwd = @SMTPUserPwd , ");                                    
            strSql.Append(" SMTPServer = @SMTPServer , ");                                    
            strSql.Append(" SMTPFromEmail = @SMTPFromEmail , ");                                    
            strSql.Append(" TiXingTime = @TiXingTime , ");                                    
            strSql.Append(" IfTiXing = @IfTiXing , ");                                    
            strSql.Append(" DaoHangList = @DaoHangList , ");                                    
            strSql.Append(" xKeGuanDep = @xKeGuanDep , ");                                    
            strSql.Append(" XiaShuUser = @XiaShuUser , ");                                    
            strSql.Append(" DaoHangIDList = @DaoHangIDList  ");            			
			strSql.Append(" where ID=@ID ");
						
SqlParameter[] parameters = {
			            new SqlParameter("@ID", SqlDbType.Int,4) ,            
                        new SqlParameter("@UserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@UserPwd", SqlDbType.NVarChar,200) ,            
                        new SqlParameter("@TrueName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Serils", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Department", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaoSe", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ActiveTime", SqlDbType.DateTime) ,            
                        new SqlParameter("@ZhiWei", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZaiGang", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@EmailStr", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@IfLogin", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@Sex", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@BackInfo", SqlDbType.NText) ,            
                        new SqlParameter("@BirthDay", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@MingZu", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SFZSerils", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@HunYing", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhengZhiMianMao", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiGuan", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@HuKou", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@XueLi", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhiCheng", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@BiYeYuanXiao", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@ZhuanYe", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@CanJiaGongZuoTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaRuBenDanWeiTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaTingDianHua", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@JiaTingAddress", SqlDbType.NVarChar,500) ,            
                        new SqlParameter("@GangWeiBianDong", SqlDbType.NText) ,            
                        new SqlParameter("@JiaoYueBeiJing", SqlDbType.NText) ,            
                        new SqlParameter("@GongZuoJianLi", SqlDbType.NText) ,            
                        new SqlParameter("@SheHuiGuanXi", SqlDbType.NText) ,            
                        new SqlParameter("@JiangChengJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@ZhiWuQingKuang", SqlDbType.NText) ,            
                        new SqlParameter("@PeiXunJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@DanBaoJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@NaoDongHeTong", SqlDbType.NText) ,            
                        new SqlParameter("@SheBaoJiaoNa", SqlDbType.NText) ,            
                        new SqlParameter("@TiJianJiLu", SqlDbType.NText) ,            
                        new SqlParameter("@BeiZhuStr", SqlDbType.NText) ,            
                        new SqlParameter("@FuJian", SqlDbType.NText) ,            
                        new SqlParameter("@POP3UserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3UserPwd", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3Server", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@POP3Port", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPUserName", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPUserPwd", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPServer", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@SMTPFromEmail", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@TiXingTime", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@IfTiXing", SqlDbType.NVarChar,50) ,            
                        new SqlParameter("@DaoHangList", SqlDbType.NText) ,            
                        new SqlParameter("@xKeGuanDep", SqlDbType.NText) ,            
                        new SqlParameter("@XiaShuUser", SqlDbType.NText) ,            
                        new SqlParameter("@DaoHangIDList", SqlDbType.NVarChar,4000)             
              
            };
						            
            parameters[0].Value = model.ID;                        
            parameters[1].Value = model.UserName;                        
            parameters[2].Value = model.UserPwd;                        
            parameters[3].Value = model.TrueName;                        
            parameters[4].Value = model.Serils;                        
            parameters[5].Value = model.Department;                        
            parameters[6].Value = model.JiaoSe;                        
            parameters[7].Value = model.ActiveTime;                        
            parameters[8].Value = model.ZhiWei;                        
            parameters[9].Value = model.ZaiGang;                        
            parameters[10].Value = model.EmailStr;                        
            parameters[11].Value = model.IfLogin;                        
            parameters[12].Value = model.Sex;                        
            parameters[13].Value = model.BackInfo;                        
            parameters[14].Value = model.BirthDay;                        
            parameters[15].Value = model.MingZu;                        
            parameters[16].Value = model.SFZSerils;                        
            parameters[17].Value = model.HunYing;                        
            parameters[18].Value = model.ZhengZhiMianMao;                        
            parameters[19].Value = model.JiGuan;                        
            parameters[20].Value = model.HuKou;                        
            parameters[21].Value = model.XueLi;                        
            parameters[22].Value = model.ZhiCheng;                        
            parameters[23].Value = model.BiYeYuanXiao;                        
            parameters[24].Value = model.ZhuanYe;                        
            parameters[25].Value = model.CanJiaGongZuoTime;                        
            parameters[26].Value = model.JiaRuBenDanWeiTime;                        
            parameters[27].Value = model.JiaTingDianHua;                        
            parameters[28].Value = model.JiaTingAddress;                        
            parameters[29].Value = model.GangWeiBianDong;                        
            parameters[30].Value = model.JiaoYueBeiJing;                        
            parameters[31].Value = model.GongZuoJianLi;                        
            parameters[32].Value = model.SheHuiGuanXi;                        
            parameters[33].Value = model.JiangChengJiLu;                        
            parameters[34].Value = model.ZhiWuQingKuang;                        
            parameters[35].Value = model.PeiXunJiLu;                        
            parameters[36].Value = model.DanBaoJiLu;                        
            parameters[37].Value = model.NaoDongHeTong;                        
            parameters[38].Value = model.SheBaoJiaoNa;                        
            parameters[39].Value = model.TiJianJiLu;                        
            parameters[40].Value = model.BeiZhuStr;                        
            parameters[41].Value = model.FuJian;                        
            parameters[42].Value = model.POP3UserName;                        
            parameters[43].Value = model.POP3UserPwd;                        
            parameters[44].Value = model.POP3Server;                        
            parameters[45].Value = model.POP3Port;                        
            parameters[46].Value = model.SMTPUserName;                        
            parameters[47].Value = model.SMTPUserPwd;                        
            parameters[48].Value = model.SMTPServer;                        
            parameters[49].Value = model.SMTPFromEmail;                        
            parameters[50].Value = model.TiXingTime;                        
            parameters[51].Value = model.IfTiXing;                        
            parameters[52].Value = model.DaoHangList;                        
            parameters[53].Value = model.xKeGuanDep;                        
            parameters[54].Value = model.XiaShuUser;                        
            parameters[55].Value = model.DaoHangIDList;                        
            int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
		
		/// <summary>
		/// 删除一条数据
		/// </summary>
		public bool Delete(int ID)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ERPUser ");
			strSql.Append(" where ID=@ID");
						SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4)
			};
			parameters[0].Value = ID;


			int rows=DbHelperSQL.ExecuteSql(strSql.ToString(),parameters);
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
		
				/// <summary>
		/// 批量删除一批数据
		/// </summary>
		public bool DeleteList(string IDlist )
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from ERPUser ");
			strSql.Append(" where ID in ("+IDlist + ")  ");
			int rows=DbHelperSQL.ExecuteSql(strSql.ToString());
			if (rows > 0)
			{
				return true;
			}
			else
			{
				return false;
			}
		}
				
		
		/// <summary>
		/// 得到一个对象实体
		/// </summary>
		public ERPUser GetModel(int ID)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ID, UserName, UserPwd, TrueName, Serils, Department, JiaoSe, ActiveTime, ZhiWei, ZaiGang, EmailStr, IfLogin, Sex, BackInfo, BirthDay, MingZu, SFZSerils, HunYing, ZhengZhiMianMao, JiGuan, HuKou, XueLi, ZhiCheng, BiYeYuanXiao, ZhuanYe, CanJiaGongZuoTime, JiaRuBenDanWeiTime, JiaTingDianHua, JiaTingAddress, GangWeiBianDong, JiaoYueBeiJing, GongZuoJianLi, SheHuiGuanXi, JiangChengJiLu, ZhiWuQingKuang, PeiXunJiLu, DanBaoJiLu, NaoDongHeTong, SheBaoJiaoNa, TiJianJiLu, BeiZhuStr, FuJian, POP3UserName, POP3UserPwd, POP3Server, POP3Port, SMTPUserName, SMTPUserPwd, SMTPServer, SMTPFromEmail, TiXingTime, IfTiXing, DaoHangList, xKeGuanDep, XiaShuUser, DaoHangIDList  ");			
			strSql.Append("  from ERPUser ");
			strSql.Append(" where ID=@ID");
						SqlParameter[] parameters = {
					new SqlParameter("@ID", SqlDbType.Int,4)
			};
			parameters[0].Value = ID;

			
			ERPUser model=new ERPUser();
			DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
			
			if(ds.Tables[0].Rows.Count>0)
			{
												if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
				{
					model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
				}
																																				model.UserName= ds.Tables[0].Rows[0]["UserName"].ToString();
																																model.UserPwd= ds.Tables[0].Rows[0]["UserPwd"].ToString();
																																model.TrueName= ds.Tables[0].Rows[0]["TrueName"].ToString();
																																model.Serils= ds.Tables[0].Rows[0]["Serils"].ToString();
																																model.Department= ds.Tables[0].Rows[0]["Department"].ToString();
																																model.JiaoSe= ds.Tables[0].Rows[0]["JiaoSe"].ToString();
																												if(ds.Tables[0].Rows[0]["ActiveTime"].ToString()!="")
				{
					model.ActiveTime=DateTime.Parse(ds.Tables[0].Rows[0]["ActiveTime"].ToString());
				}
																																				model.ZhiWei= ds.Tables[0].Rows[0]["ZhiWei"].ToString();
																																model.ZaiGang= ds.Tables[0].Rows[0]["ZaiGang"].ToString();
																																model.EmailStr= ds.Tables[0].Rows[0]["EmailStr"].ToString();
																																model.IfLogin= ds.Tables[0].Rows[0]["IfLogin"].ToString();
																																model.Sex= ds.Tables[0].Rows[0]["Sex"].ToString();
																																model.BackInfo= ds.Tables[0].Rows[0]["BackInfo"].ToString();
																																model.BirthDay= ds.Tables[0].Rows[0]["BirthDay"].ToString();
																																model.MingZu= ds.Tables[0].Rows[0]["MingZu"].ToString();
																																model.SFZSerils= ds.Tables[0].Rows[0]["SFZSerils"].ToString();
																																model.HunYing= ds.Tables[0].Rows[0]["HunYing"].ToString();
																																model.ZhengZhiMianMao= ds.Tables[0].Rows[0]["ZhengZhiMianMao"].ToString();
																																model.JiGuan= ds.Tables[0].Rows[0]["JiGuan"].ToString();
																																model.HuKou= ds.Tables[0].Rows[0]["HuKou"].ToString();
																																model.XueLi= ds.Tables[0].Rows[0]["XueLi"].ToString();
																																model.ZhiCheng= ds.Tables[0].Rows[0]["ZhiCheng"].ToString();
																																model.BiYeYuanXiao= ds.Tables[0].Rows[0]["BiYeYuanXiao"].ToString();
																																model.ZhuanYe= ds.Tables[0].Rows[0]["ZhuanYe"].ToString();
																																model.CanJiaGongZuoTime= ds.Tables[0].Rows[0]["CanJiaGongZuoTime"].ToString();
																																model.JiaRuBenDanWeiTime= ds.Tables[0].Rows[0]["JiaRuBenDanWeiTime"].ToString();
																																model.JiaTingDianHua= ds.Tables[0].Rows[0]["JiaTingDianHua"].ToString();
																																model.JiaTingAddress= ds.Tables[0].Rows[0]["JiaTingAddress"].ToString();
																																model.GangWeiBianDong= ds.Tables[0].Rows[0]["GangWeiBianDong"].ToString();
																																model.JiaoYueBeiJing= ds.Tables[0].Rows[0]["JiaoYueBeiJing"].ToString();
																																model.GongZuoJianLi= ds.Tables[0].Rows[0]["GongZuoJianLi"].ToString();
																																model.SheHuiGuanXi= ds.Tables[0].Rows[0]["SheHuiGuanXi"].ToString();
																																model.JiangChengJiLu= ds.Tables[0].Rows[0]["JiangChengJiLu"].ToString();
																																model.ZhiWuQingKuang= ds.Tables[0].Rows[0]["ZhiWuQingKuang"].ToString();
																																model.PeiXunJiLu= ds.Tables[0].Rows[0]["PeiXunJiLu"].ToString();
																																model.DanBaoJiLu= ds.Tables[0].Rows[0]["DanBaoJiLu"].ToString();
																																model.NaoDongHeTong= ds.Tables[0].Rows[0]["NaoDongHeTong"].ToString();
																																model.SheBaoJiaoNa= ds.Tables[0].Rows[0]["SheBaoJiaoNa"].ToString();
																																model.TiJianJiLu= ds.Tables[0].Rows[0]["TiJianJiLu"].ToString();
																																model.BeiZhuStr= ds.Tables[0].Rows[0]["BeiZhuStr"].ToString();
																																model.FuJian= ds.Tables[0].Rows[0]["FuJian"].ToString();
																																model.POP3UserName= ds.Tables[0].Rows[0]["POP3UserName"].ToString();
																																model.POP3UserPwd= ds.Tables[0].Rows[0]["POP3UserPwd"].ToString();
																																model.POP3Server= ds.Tables[0].Rows[0]["POP3Server"].ToString();
																																model.POP3Port= ds.Tables[0].Rows[0]["POP3Port"].ToString();
																																model.SMTPUserName= ds.Tables[0].Rows[0]["SMTPUserName"].ToString();
																																model.SMTPUserPwd= ds.Tables[0].Rows[0]["SMTPUserPwd"].ToString();
																																model.SMTPServer= ds.Tables[0].Rows[0]["SMTPServer"].ToString();
																																model.SMTPFromEmail= ds.Tables[0].Rows[0]["SMTPFromEmail"].ToString();
																																model.TiXingTime= ds.Tables[0].Rows[0]["TiXingTime"].ToString();
																																model.IfTiXing= ds.Tables[0].Rows[0]["IfTiXing"].ToString();
																																model.DaoHangList= ds.Tables[0].Rows[0]["DaoHangList"].ToString();
																																model.xKeGuanDep= ds.Tables[0].Rows[0]["xKeGuanDep"].ToString();
																																model.XiaShuUser= ds.Tables[0].Rows[0]["XiaShuUser"].ToString();
																																model.DaoHangIDList= ds.Tables[0].Rows[0]["DaoHangIDList"].ToString();
																										
				return model;
			}
			else
			{
				return null;
			}
		}
		
		
		/// <summary>
		/// 获得数据列表
		/// </summary>
		public DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select * ");
			strSql.Append(" FROM ERPUser ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			return DbHelperSQL.Query(strSql.ToString());
		}
		
		/// <summary>
		/// 获得前几行数据
		/// </summary>
		public DataSet GetList(int Top,string strWhere,string filedOrder)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("select ");
			if(Top>0)
			{
				strSql.Append(" top "+Top.ToString());
			}
			strSql.Append(" * ");
			strSql.Append(" FROM ERPUser ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			strSql.Append(" order by " + filedOrder);
			return DbHelperSQL.Query(strSql.ToString());
		}
		
		
		        /// <summary>
        /// 获取分页数据
        /// </summary>
        /// <param name="pageIndex">从0开始</param>
        /// <param name="pageSize"></param>
        /// <param name="strWhere"></param>
        /// <param name="filedOrder"></param>
        /// <returns></returns>
		public DataSet GetList(int pageIndex,int pageSize, string strWhere  = null,string filedOrder = null)
		{
			var startIndex = pageIndex * pageSize + 1;
			var endIndex = (pageIndex + 1) * pageSize;
			var totalCount = 0;
			
			var totalCountSqlBuilder = new StringBuilder();
			totalCountSqlBuilder.Append(" SELECT COUNT([ID]) FROM ERPUser ");
			if(!string.IsNullOrEmpty(strWhere))
			{
				totalCountSqlBuilder.Append(" where "+strWhere);
			}
			totalCount = (int)DbHelperSQL.GetSingle(totalCountSqlBuilder.ToString());
			
				StringBuilder strSql=new StringBuilder();
				strSql.Append("select TOP "+pageSize.ToString()+" t.* from ");
				strSql.Append("(select ");
				strSql.Append(" row_number() over (" );
				if(!string.IsNullOrEmpty(filedOrder))
				{
					strSql.Append(" order by " + filedOrder);
				}
				else 
				{
					strSql.Append(" ORDER BY [ID] ");
				}
				strSql.Append(") AS ___rownum, ");
				
				strSql.Append(" * ");
				strSql.Append(" FROM ERPUser ");
				if(!string.IsNullOrEmpty(strWhere))
				{
					strSql.Append(" where "+strWhere);
				}
				strSql.Append(") t ");
				strSql.Append(" where t.___rownum>="+startIndex.ToString()+" AND t.___rownum<="+endIndex.ToString());
				if(!string.IsNullOrEmpty(filedOrder))
				{
					strSql.Append(" order by " + filedOrder);
				}
				
				var dataSet = DbHelperSQL.Query(strSql.ToString());
					
            if (totalCount > 0 && startIndex <= totalCount)
			{		
				for(var i=1;i<startIndex;i++)
				{
					dataSet.Tables[0].Rows.InsertAt(dataSet.Tables[0].NewRow(),0);				
				}
				for(var i=endIndex;i<totalCount;i++)
				{
					dataSet.Tables[0].Rows.Add(dataSet.Tables[0].NewRow());
				}
			}
			return dataSet;
		}
				#endregion
   
   		#region IPVDomain
   		public string GetDbTableName()
   		{
   			return "ERPUser";
   		}
   		#endregion
	}
}

